3.189 \(\int \frac{a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx\)

Optimal. Leaf size=67 \[ \frac{2 (b c-a d) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{c f \sqrt{c-d} \sqrt{c+d}}+\frac{a x}{c} \]

[Out]

(a*x)/c + (2*(b*c - a*d)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(c*Sqrt[c - d]*Sqrt[c + d]*f)

________________________________________________________________________________________

Rubi [A]  time = 0.125556, antiderivative size = 67, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.174, Rules used = {3919, 3831, 2659, 208} \[ \frac{2 (b c-a d) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{c f \sqrt{c-d} \sqrt{c+d}}+\frac{a x}{c} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Sec[e + f*x])/(c + d*Sec[e + f*x]),x]

[Out]

(a*x)/c + (2*(b*c - a*d)*ArcTanh[(Sqrt[c - d]*Tan[(e + f*x)/2])/Sqrt[c + d]])/(c*Sqrt[c - d]*Sqrt[c + d]*f)

Rule 3919

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.) + (c_))/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Simp[(c*x)/a,
x] - Dist[(b*c - a*d)/a, Int[Csc[e + f*x]/(a + b*Csc[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[
b*c - a*d, 0]

Rule 3831

Int[csc[(e_.) + (f_.)*(x_)]/(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[1/b, Int[1/(1 + (a*Sin[e
 + f*x])/b), x], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 2659

Int[((a_) + (b_.)*sin[Pi/2 + (c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> With[{e = FreeFactors[Tan[(c + d*x)/2], x
]}, Dist[(2*e)/d, Subst[Int[1/(a + b + (a - b)*e^2*x^2), x], x, Tan[(c + d*x)/2]/e], x]] /; FreeQ[{a, b, c, d}
, x] && NeQ[a^2 - b^2, 0]

Rule 208

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-(a/b), 2]*ArcTanh[x/Rt[-(a/b), 2]])/a, x] /; FreeQ[{a,
b}, x] && NegQ[a/b]

Rubi steps

\begin{align*} \int \frac{a+b \sec (e+f x)}{c+d \sec (e+f x)} \, dx &=\frac{a x}{c}-\frac{(-b c+a d) \int \frac{\sec (e+f x)}{c+d \sec (e+f x)} \, dx}{c}\\ &=\frac{a x}{c}-\frac{(-b c+a d) \int \frac{1}{1+\frac{c \cos (e+f x)}{d}} \, dx}{c d}\\ &=\frac{a x}{c}+\frac{(2 (b c-a d)) \operatorname{Subst}\left (\int \frac{1}{1+\frac{c}{d}+\left (1-\frac{c}{d}\right ) x^2} \, dx,x,\tan \left (\frac{1}{2} (e+f x)\right )\right )}{c d f}\\ &=\frac{a x}{c}+\frac{2 (b c-a d) \tanh ^{-1}\left (\frac{\sqrt{c-d} \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c+d}}\right )}{c \sqrt{c-d} \sqrt{c+d} f}\\ \end{align*}

Mathematica [A]  time = 0.151059, size = 68, normalized size = 1.01 \[ \frac{\frac{2 (a d-b c) \tanh ^{-1}\left (\frac{(d-c) \tan \left (\frac{1}{2} (e+f x)\right )}{\sqrt{c^2-d^2}}\right )}{\sqrt{c^2-d^2}}+a (e+f x)}{c f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Sec[e + f*x])/(c + d*Sec[e + f*x]),x]

[Out]

(a*(e + f*x) + (2*(-(b*c) + a*d)*ArcTanh[((-c + d)*Tan[(e + f*x)/2])/Sqrt[c^2 - d^2]])/Sqrt[c^2 - d^2])/(c*f)

________________________________________________________________________________________

Maple [A]  time = 0.066, size = 113, normalized size = 1.7 \begin{align*} 2\,{\frac{a\arctan \left ( \tan \left ( 1/2\,fx+e/2 \right ) \right ) }{fc}}-2\,{\frac{ad}{fc\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{\tan \left ( 1/2\,fx+e/2 \right ) \left ( c-d \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) }+2\,{\frac{b}{f\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}{\it Artanh} \left ({\frac{\tan \left ( 1/2\,fx+e/2 \right ) \left ( c-d \right ) }{\sqrt{ \left ( c+d \right ) \left ( c-d \right ) }}} \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x)

[Out]

2/f*a/c*arctan(tan(1/2*f*x+1/2*e))-2/f/c/((c+d)*(c-d))^(1/2)*arctanh(tan(1/2*f*x+1/2*e)*(c-d)/((c+d)*(c-d))^(1
/2))*a*d+2/f/((c+d)*(c-d))^(1/2)*arctanh(tan(1/2*f*x+1/2*e)*(c-d)/((c+d)*(c-d))^(1/2))*b

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [A]  time = 0.59345, size = 540, normalized size = 8.06 \begin{align*} \left [\frac{2 \,{\left (a c^{2} - a d^{2}\right )} f x -{\left (b c - a d\right )} \sqrt{c^{2} - d^{2}} \log \left (\frac{2 \, c d \cos \left (f x + e\right ) -{\left (c^{2} - 2 \, d^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, \sqrt{c^{2} - d^{2}}{\left (d \cos \left (f x + e\right ) + c\right )} \sin \left (f x + e\right ) + 2 \, c^{2} - d^{2}}{c^{2} \cos \left (f x + e\right )^{2} + 2 \, c d \cos \left (f x + e\right ) + d^{2}}\right )}{2 \,{\left (c^{3} - c d^{2}\right )} f}, \frac{{\left (a c^{2} - a d^{2}\right )} f x +{\left (b c - a d\right )} \sqrt{-c^{2} + d^{2}} \arctan \left (-\frac{\sqrt{-c^{2} + d^{2}}{\left (d \cos \left (f x + e\right ) + c\right )}}{{\left (c^{2} - d^{2}\right )} \sin \left (f x + e\right )}\right )}{{\left (c^{3} - c d^{2}\right )} f}\right ] \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="fricas")

[Out]

[1/2*(2*(a*c^2 - a*d^2)*f*x - (b*c - a*d)*sqrt(c^2 - d^2)*log((2*c*d*cos(f*x + e) - (c^2 - 2*d^2)*cos(f*x + e)
^2 - 2*sqrt(c^2 - d^2)*(d*cos(f*x + e) + c)*sin(f*x + e) + 2*c^2 - d^2)/(c^2*cos(f*x + e)^2 + 2*c*d*cos(f*x +
e) + d^2)))/((c^3 - c*d^2)*f), ((a*c^2 - a*d^2)*f*x + (b*c - a*d)*sqrt(-c^2 + d^2)*arctan(-sqrt(-c^2 + d^2)*(d
*cos(f*x + e) + c)/((c^2 - d^2)*sin(f*x + e))))/((c^3 - c*d^2)*f)]

________________________________________________________________________________________

Sympy [F]  time = 0., size = 0, normalized size = 0. \begin{align*} \int \frac{a + b \sec{\left (e + f x \right )}}{c + d \sec{\left (e + f x \right )}}\, dx \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x)

[Out]

Integral((a + b*sec(e + f*x))/(c + d*sec(e + f*x)), x)

________________________________________________________________________________________

Giac [A]  time = 1.47724, size = 142, normalized size = 2.12 \begin{align*} \frac{\frac{{\left (f x + e\right )} a}{c} + \frac{2 \,{\left (\pi \left \lfloor \frac{f x + e}{2 \, \pi } + \frac{1}{2} \right \rfloor \mathrm{sgn}\left (-2 \, c + 2 \, d\right ) + \arctan \left (-\frac{c \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{\sqrt{-c^{2} + d^{2}}}\right )\right )}{\left (b c - a d\right )}}{\sqrt{-c^{2} + d^{2}} c}}{f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*sec(f*x+e))/(c+d*sec(f*x+e)),x, algorithm="giac")

[Out]

((f*x + e)*a/c + 2*(pi*floor(1/2*(f*x + e)/pi + 1/2)*sgn(-2*c + 2*d) + arctan(-(c*tan(1/2*f*x + 1/2*e) - d*tan
(1/2*f*x + 1/2*e))/sqrt(-c^2 + d^2)))*(b*c - a*d)/(sqrt(-c^2 + d^2)*c))/f